package pattern.controller;

import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import pattern.WorkServiceTool;
import pattern.annontations.Secure;
import pattern.cache.InitCache;
import pattern.dto.User;
import pattern.exception.PatternException;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * @author Simon
 */
@Api(tags = "work Feign服务")
@Controller
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@Secure(-1)
@Slf4j
@ApiIgnore
public class WorkFeignController {

    private final InitCache initCache;

    @GetMapping("search_user_by_type")
    public List<User> addUser(@RequestParam("userType") String userType) throws PatternException {
        return WorkServiceTool.getUserService().searchUserByType(userType);
    }
}
